<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>系统主界面</title>
<link rel="shortcut icon" href="images/logo/pdps1.ico"/>
<%
	if(session.getAttribute("currentUser") == null){
		response.sendRedirect("login.jsp");
		return;
	}
%>
<link rel="stylesheet" type="text/css" href="jquery-easyui-1.3.3/themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="jquery-easyui-1.3.3/themes/icon.css">
<script type="text/javascript" src="jquery-easyui-1.3.3/jquery.min.js"></script>
<script type="text/javascript" src="jquery-easyui-1.3.3/jquery.easyui.min.js"></script>
<script type="text/javascript" src="jquery-easyui-1.3.3/locale/easyui-lang-zh_CN.js"></script>
<script type="text/javascript">
	$(function() {
		$("#tree").tree({
			lines:true,
			url:"auth?action=menu&parentId=-1",
			onLoadSuccess:function(){
				$("#tree").tree('expandAll');
			},
			onClick:function(node) {
				if(node.id == 15){
					alert("修改密码");
				}else if(node.id == 16){
					alert("安全退出");
				}else if(node.attributes.authPath){
					openTab(node);
				}
			}
		});
		
		function openTab(node) {
			
			if($("#tabs").tabs("exists",node.text)){
				
				$("#tabs").tabs("select",node.text);
				
			}else{
				
				var content = "<iframe frameborder=0 scrolling='auto' style='width=100%;heigth=100%;' src="+node.attributes.authPath+"></iframe>";
				$("#tabs").tabs("add",{
					title:node.text,
					iconCls:node.iconCls,
					closable:true,
					content:content
				});
			}
		}
	});
</script>
</head>
<body class="easyui-layout">
	<!-- 北边 -->
	<div region="north" style="height: 68px;">
		<div style="padding: 0px;margin: 0px;background-color:#E0ECFF;">
			<table>
				<tr>
					<td><img alt="基于easyUI的权限管理系统" src="images/mainlogo.png"></td>
					<td valign="bottom"><font color="#243445" size="5">欢迎当前登录用户：${currentUser.userName}&nbsp;『${currentUser.roleName}』角色</font></td>
				</tr>
			</table>
		</div>
	</div>
	<!-- 中间 -->
	<div region="center">
		<div class="easyui-tabs" fit="true" border="false" id="tabs">
			<div title="首页" data-options="iconCls:'icon-home'">
				<div align="center" style="padding-top: 10px;"><font color="red" size="10px;">欢迎使用</font></div>
			</div>
		</div>
	</div>
	<!-- 西边 -->
	<div region="west" style="width: 160px;padding: 5px;" title="导航菜单" split="true">
		<ul id="tree" class="easyui-tree"></ul>
	</div>
	<!-- 南边 -->
	<div region="south" style="height: 25px;padding: 5px;" align="center">
		版权所有 dubito <a href="https://www.baidu.com" target="_blank">www.baidu.com</a>
	</div>
</body>
</html>